package com.catering.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.catering.entity.CateringGroupBuying;
import com.catering.entity.vo.CateringGroupBuyingVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CateringGroupBuyingDao extends BaseMapper<CateringGroupBuying> {

    @Select("select t1.*,t2.goods_price,t2.goods_name,t2.discount,t2.delivery_type,t2.goods_img,t2.inter_num,t2.remark,t2.sale_num,t2.goods_weight,t3.acti_name,t3.group_size,t3.acti_price from catering_group_buying t1 left join catering_group_activities t3 on t3.sys_id=t1.activity_id left join catering_goods t2 on t3.goods_id = t2.sys_id ${ew.customSqlSegment}")
    public IPage<CateringGroupBuyingVo> selectPageList(IPage<CateringGroupBuying> page, @Param(Constants.WRAPPER) QueryWrapper<CateringGroupBuying> queryWrapper);

    @Select("select count(1) from catering_group_buying t1 left join catering_group_activities t3 on t3.sys_id=t1.activity_id left join catering_goods t2 on t3.goods_id = t2.sys_id ${ew.customSqlSegment}")
    public int selectPageCount(@Param(Constants.WRAPPER) QueryWrapper<CateringGroupBuying> queryWrapper);

    @Select("select t1.*,t2.goods_price,t2.goods_name,t2.discount,t2.delivery_type,t2.goods_img,t2.inter_num,t2.remark,t2.sale_num,t2.goods_weight,t3.acti_name,t3.group_size,t3.acti_price from catering_group_buying t1 left join catering_group_activities t3 on t3.sys_id=t1.activity_id left join catering_goods t2 on t3.goods_id = t2.sys_id ${ew.customSqlSegment}")
    public List<CateringGroupBuyingVo> selectNoPageList(@Param(Constants.WRAPPER) QueryWrapper<CateringGroupBuying> queryWrapper);
	
}
